//package com.buric.common.config;
//
//
//import com.buric.common.interceptor.HeaderInterceptor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//import org.springframework.web.filter.CorsFilter;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * 拦截器配置
// *
// * @author zhouwei
// */
//public class WebMvcConfig extends WebMvcConfigurationSupport {
//    /**
//     * 不需要拦截地址
//     */
//    public static final String[] excludeUrls = {"/login", "/logout", "/refresh","/swagger-ui.html/**","/doc.html/**",
//            "/*.ico","/swagger-resources/**","/null/swagger-resources","/webjars/**","/v2/**","/static/**"};
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
////        registry.addInterceptor(getHeaderInterceptor())
////                .addPathPatterns("/**")
////                .excludePathPatterns(excludeUrls)
////                .order(-10);
//        super.addInterceptors(registry);
//    }
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/**").addResourceLocations(
//                "classpath:/static/");
//        registry.addResourceHandler("/static/**").addResourceLocations(
//                "classpath:/static/");
//        registry.addResourceHandler("swagger-ui.html").addResourceLocations(
//                "classpath:/META-INF/resources/");
//        registry.addResourceHandler("doc.html").addResourceLocations(
//                "classpath:/META-INF/resources/");
//        registry.addResourceHandler("/v3/api-docs/**")
//                .addResourceLocations("classpath:/META-INF/resources/");
//        registry.addResourceHandler("/webjars/**").addResourceLocations(
//                "classpath:/META-INF/resources/webjars/").resourceChain(false);
//
//        super.addResourceHandlers(registry);
//    }
//
//
//    /**
//     * 跨域配置
//     */
//    @Bean
//    public CorsFilter corsFilter() {
//        final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
//        final CorsConfiguration corsConfiguration = new CorsConfiguration();
//        corsConfiguration.addAllowedOrigin("*");
//        corsConfiguration.addAllowedHeader("*");
//        corsConfiguration.addAllowedMethod("*");
//        urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
//        return new CorsFilter(urlBasedCorsConfigurationSource);
//    }
//
//    /**
//     * 自定义请求头拦截器
//     */
//    public HeaderInterceptor getHeaderInterceptor() {
//        return new HeaderInterceptor();
//    }
//}
